#@head("新增/编辑用户")
#define main()
	<link rel="stylesheet" href="#(ctx)/assets/layuiadmin/style/form.css" media="all">
#end
<body>
	<div class="layui-form layui-form-pane" lay-filter="layuiadmin-form-system" id="layuiadmin-form-system">
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">类型</label>
					<div class="layui-input-block">
						<select name="model.user_type" lay-verify="required">
							<option value="">--请选择--</option>
							<option value="1" #(model.user_type?? == 1 ? "selected" : "")>系统管理员</option>
							<option value="2" #(model.user_type?? == 2 ? "selected" : "")>普通用户</option>
							<option value="5" #(model.user_type?? == 5 ? "selected" : "")>API用户</option>
		                    <option value="3" #(model.user_type?? == 3 ? "selected" : "")>前台用户</option>
		                    <option value="4" #(model.user_type?? == 4 ? "selected" : "")>第三方用户</option>
		                    <option value="9" #(model.user_type?? == 9 ? "selected" : "")>其他用户</option>
						</select>
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">所属部门</label>
					<div class="layui-input-block">
						<select name="model.org_id" lay-verify="required">
							<option value="">--请选择--</option>
				        	#(orgSelect)
						</select>
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">登录账号</label>
					<div class="layui-input-block">
						<input type="text" name="model.logn_acct" value="#(model.logn_acct??)" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">姓名</label>
					<div class="layui-input-block">
						<input type="text" name="model.real_name" value="#(model.real_name??)" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">Email</label>
					<div class="layui-input-block">
						<input type="text" name="model.email" value="#(model.email??)" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">联系电话</label>
					<div class="layui-input-block">
						<input type="text" name="model.phone" value="#(model.phone??)" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">联系地址</label>
					<div class="layui-input-block">
						<input type="text" name="model.address" value="#(model.address??)" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
				<div class="layui-form-item">
					<label class="layui-form-label">头像</label>
					<div class="layui-input-inline">
						<input type="text" name="model.avatar" value="#(model.avatar??)" id="LAY_avatarSrc" placeholder="请上传图片" autocomplete="off" class="layui-input">
					</div>
					<button style="float: left;" class="layui-btn" id="layuiadmin-upload-user-img"><i class="layui-icon"></i>上传图片</button> 
			    	<button style="float: left; margin-left: 5px;" class="layui-btn" layadmin-event="avartatPreview">查看图片</button >
			    	
			    </div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
			    <div class="layui-form-item">
			    	<label class="layui-form-label">说明</label>
				    <div class="layui-input-block">
				    	<input type="text" name="model.remark" value="#(model.remark??)"  placeholder="请输入" autocomplete="off" class="layui-input">
				    </div>
			    </div>
			</div>
		</div>
	    <div class="layui-row layui-col-space1 task-row">
	 		<div class="layui-col-xs12">
			    <div class="layui-form-item">
					<label class="layui-form-label">状态</label>
					<div class="layui-input-block">
						<input type="radio" name="model.status" value="1" title="正常" #(model.status?? == 1 ? 'checked' : '')>
						<input type="radio" name="model.status" value="0" title="冻结" #(model.status?? == 0 ? 'checked' : '')>
					</div>
				</div>
			</div>
		</div>
		<input type="hidden" name="model.id" value="#(model.id??)"/>
		<input type="hidden" name="model.theme" value="#(model.theme?? 'default')"/>
		<div class="layui-form-item layui-hide">
			<input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
		</div>
	</div>
	#@layui()
	#define use()
		use(["index", "form", "upload"], function(){
			var $ = layui.$,
			form = layui.form,
			upload = layui.upload,
			a = (layui.laytpl, layui.setter, layui.view, layui.admin);
			
			var r = $("#LAY_avatarSrc");
			upload.render({
				elem: '#layuiadmin-upload-user-img',
				url: layui.setter.base + '/system/user/upload',
				size: 1024,
				done: function(res){
					r.val(res.imgUrl);
				}
			}),a.events.avartatPreview = function(t) {
				var i = r.val();
				if(i!=""){
					layui.layer.photos({
						photos: {
							title: "查看头像",
							data: [{
								src: "#(ctx)" + i
							}]
						},
						shade: .01,
						closeBtn: 1,
						anim: 5
					});
				}
			};
		})
	#end
</body>
</html>